home *** CD-ROM | disk | FTP | other *** search
/ CD ROM Paradise Collection 4 / CD ROM Paradise Collection 4 1995 Nov.iso / program / swaga_c.zip / CURSOR.SWG / 0010_Cursor Manipulations.pas < prev    next >
Pascal/Delphi Source File  |  1993-07-16  |  2KB  |  95 lines

  1.  
  2. { unit to manipulate the text cursor }
  3.  
  4. unit Cursor;
  5.  
  6. INTERFACE
  7.  
  8. TYPE
  9.  
  10.   PCursorRec = ^TCursorShape;
  11.   TCursorShape = record
  12.     Start : byte;
  13.     Stop  : byte;
  14.   end;
  15.  
  16. procedure GetCursorShape (var Shape : TCursorShape);
  17. { Sets the Start and Stop fields of Shape }
  18.  
  19. procedure CursorOff;
  20. { Turns the cursor off }
  21.  
  22. procedure NormCursorOn;
  23. { Turns underscore cursor on }
  24.  
  25. procedure BlockCursorOn;
  26. { Turns block cursor on }
  27.  
  28. procedure SetCursorShape (Shape : TCursorShape);
  29. { Set cursor shape with Start and Stop fields of Shape }
  30.  
  31. IMPLEMENTATION
  32. VAR
  33.    VideoMode : BYTE ABSOLUTE $0040 : $0049; { Video mode: Mono=7, Color=0-3 }
  34.  
  35. procedure GetCursorShape (var Shape : TCursorShape); assembler;
  36.   asm
  37.     mov ah,$03
  38.     mov bx,$00
  39.     int $10
  40.     les di,Shape
  41.     mov TCursorShape (es:[di]).Start,ch    {es:[di] is Start field of Shape}
  42.     mov TCursorShape (es:[di]).Stop,cl  {es:[di+1] is Stop field of Shape}
  43.   end;
  44.  
  45. procedure SetCursorShape; assembler;
  46.   asm
  47.     mov ah,$01             { Service 1, set cursor size }
  48.     mov ch,Shape.Start
  49.     mov cl,Shape.Stop
  50.     int $10
  51.   end;
  52.  
  53. procedure CursorOff;  assembler;
  54.   asm
  55.     mov ah,$01
  56.     mov ch,$20
  57.     mov cl,$00
  58.     int $10
  59.   end;
  60.  
  61. procedure NormCursorOn;
  62.   var
  63.     Shape : TCursorShape;
  64.   begin
  65.     if VideoMode = 7 then
  66.       begin
  67.         Shape.Start := $0A;
  68.         Shape.Stop  := $0B;
  69.       end
  70.     else
  71.       begin
  72.         Shape.Start := $06;
  73.         Shape.Stop  := $07;
  74.       end;
  75.     SetCursorShape (Shape);
  76.   end;
  77.  
  78. procedure BlockCursorOn;
  79.   var
  80.     Shape : TCursorShape;
  81.   begin
  82.     if VideoMode = 7 then
  83.       begin
  84.         Shape.Start := $02;
  85.         Shape.Stop  := $0B;
  86.       end
  87.     else
  88.       begin
  89.         Shape.Start := $02;
  90.         Shape.Stop  := $08;
  91.       end;
  92.     SetCursorShape (Shape);
  93.   end;
  94.  
  95. END.